<template>
    <div>
        <div class="title">
            <div>
                <el-input v-model="ip" placeholder="请输入分拣机IP"></el-input><el-button @click="setIp">设置分拣机ip</el-button>
            </div>
            <div>
                <el-input v-model="addressId" placeholder="请输入收银台默认地址Id"></el-input><el-button @click="setAddressId">设置默认地址ID</el-button>
            </div>
        
        </div>
    </div>
</template>

<script>
    import {getStore, setStore} from "@/util/store";

    export default {
        data: function(){
            return {
                ip: this.getStore({name: "ip"}),
                addressId: ""
            }
        },
        components:{

        },
        watch:{
        },
        created(){
        },
        methods:{
            setIp(){
                try {
                    setStore({name: "ip", content: this.ip});
                    this.$message.success("保存成功！")
                } catch (error) {
                    this.$message.warning(error)
                }
                
            },
            setAddressId(){
                try {
                    setStore({name: "addressId", content: this.addressId});
                    this.$message.success("保存成功！")
                } catch (error) {
                    this.$message.warning(error)
                }

            }
        }
    }
</script>

<style scoped lang="scss">
    .title{
        display: flex;
        background-color: white;
        padding: 10px;
        margin-bottom: 20px;
        justify-content: space-between;
        >div{
            display: flex;
            width: 350px;
            align-self: center;
        }
    }
</style>
